# uncompyle6 version 3.2.3
# Python bytecode 3.6 (3379)
# Decompiled from: Python 3.6.8 |Anaconda custom (64-bit)| (default, Feb 21 2019, 18:30:04) [MSC v.1916 64 bit (AMD64)]
# Embedded file name: scanners\scan_app\errors.py
__author__ = "Attila Gerendi (Sanyi)"
from server.http_responses.http_errors import Http409, Http404, ApiErrors


class ScanningAppBaseException(Exception):
    str_message = "Error"


class StartFailed(ScanningAppBaseException):
    str_message = "start_failed"


class NoMoreWorkerSlots(Http409, StartFailed):
    str_message = "no_more_worker_slots"

    def __init__(self):
        super().__init__(
            message=self.str_message, code=ApiErrors.SA_NO_MORE_WORKER_SLOTS
        )


class NoMoreWorkers(StartFailed):
    str_message = "no_more_workers"


class ManualInterventionOnRemoteMachine(StartFailed):
    str_message = "manual_intervention_on_remote"


class FixedWorkerNotFound(StartFailed):
    str_message = "fixed_worker_not_found"


class FixedWorkerIsOffline(StartFailed):
    str_message = "fixed_worker_is_offline"


class FixedWorkerIsDetachedOrNotAuthorized(StartFailed):
    str_message = "fixed_worker_is_detached_or_not_authorized"


class DuplicateJobId(Http409, StartFailed):
    str_message = "duplicate_job_id"

    def __init__(self):
        super().__init__(message=self.str_message, code=ApiErrors.SA_DUPLICATE_JOB_ID)


class JobNotFound(Http404, ScanningAppBaseException):
    str_message = "job_not_found"

    def __init__(self):
        super().__init__(message=self.str_message, code=ApiErrors.SA_JOB_NOT_FOUND)


class WorkerTerminated(Http404, ScanningAppBaseException):
    str_message = "worker_terminated"

    def __init__(self):
        super().__init__(message=self.str_message, code=ApiErrors.SA_WORKER_TERMINATED)


class WorkerNotFound(ScanningAppBaseException):
    str_message = "worker_not_found"


class WorkerOffline(WorkerNotFound):
    str_message = "worker_offline"


class WorkerNotAuthorized(WorkerNotFound):
    str_message = "worker_not_authorized"


class WorkerNotReady(WorkerNotFound):
    str_message = "worker_not_ready"
